﻿/***************************************************************************
*		功能：
*		作者：     @AuthorName@
*		日期：     @Datetime@
*		
*		修改日期：
*		修改人：
*		修改内容：
* *************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Deeper.DataAccess;
using Deeper.Common;
using @ProjectName@.@ModelNameSpace@;

namespace @ProjectName@.@ServiceNameSpace@
{
	/// <summary>
	/// @ClassSummary@
	/// </summary>
	[Serializable]
	public partial class @ClassName@Info 
	{

		public @ClassName@ @ClassName@Entity { private set; get; }

		public @ClassName@Info(@ClassName@ u)
		{
			this.@ClassName@Entity = u;
		}

		public IList<string> check()
		{
			return check(HDatabase.CurrentDatabase);
		}

		public IList<string> check(HDatabase databse)
		{
			Validator<@ClassName@> validator = new Validator<@ClassName@>(this.@ClassName@Entity);
			return validator.Validate(u => {})
				.ErrorMessage;
		}
		
		public void Save()
		{
			try
			{
				HDatabase.TransBegin();
				@ClassName@Entity.Save();
				HDatabase.TransCommit();
			}
			catch(Exception ex)
			{
				HDatabase.TransRollback();
				throw ex;
			}
		}
		
		public static  @ClassName@Info GetEntityById(int uid)
		{
			@ClassName@ Entity =  @ClassName@.GetEntityById(uid);
			@ClassName@Info user =  Entity.IsNull() ? null : new  @ClassName@Info(Entity);
			return user;
		}
		
	}
}